package com.yunhe.merchants.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunhe.common.annotation.*;
import com.yunhe.common.util.StringUtil;
import com.yunhe.merchants.constant.MyProjectConsts;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @Author: DongWenYu
 * @Date: 2021/5/13 9:19
 */
public class MyProject implements Serializable {


    private static final long serialVersionUID = 7297709921127230641L;
    /**
     * id
     */
    private Long id;

    /**
     * 企业名称
     */
    private String companyName;

    /**
     * 客户名称
     */
    private String custName;

    /**
     * 客户电话
     */
    private String custTel;

    /**
     * 企业行业
     */
    @CodeFromTitle(code = "industryCategory")
    private String industryType;

    /**
     * 企业行业Title
     */
    @EnumItemCode(code = "industryCategory")
    private String industryTypeTitle;

    /**
     * 数据来源
     */
    @CodeFromTitle(code = "channelSource")
    private String dataSource;

    /**
     * 数据来源Title
     */
    @EnumItemCode(code = "channelSource")
    private String dataSourceTitle;

    /**
     * 当前状态
     */
    @CodeFromTitle(code = "companyStatus")
    private String companyStatus;

    @ApiModelProperty("失败节点")
    private String failedNode;

    /**
     * 当前状态Title
     */
    @EnumItemCode(code = "companyStatus")
    private String companyStatusTitle;

    private String companyStatusName;

    /**
     * 负责人
     */
    private Long principal;

    /**
     * 负责人Title
     */
    @UserName(userId = "principal")
    private String principalTitle;


    /**
     * 负责人电话
     */
    @UserPhone(userId = "principal")
    private String principalPhone;

    /**
     * 负责部门
     */
    private Long responsibleDept;

    /**
     * 负责部门Title
     */
    @OrgName(orgId = "responsibleDept")
    private String responsibleDeptTitle;

    /**
     * 录入人
     */
    private Long entryPerson;
    /**
     * 录入人
     */
    @UserName(userId = "entryPerson")
    private String entryPersonTitle;


    /**
     * 录入部门
     */
    private Long entryDept;

    /**
     * 录入部门
     */
    @OrgName(orgId = "entryDept")
    private String entryDeptTitle;

    /**
     * 离场原因
     */
    @CodeFromTitle(code = "leavingReason")
    private String leavingReason;

    /**
     * 最新去向
     */
    private String latestDestination;

    /**
     * 离场原因
     */
    @EnumItemCode(code = "leavingReason")
    private String leavingReasonTitle;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    /**
     * 更新人
     */
    private Long updater;

    /**
     * 更新人名字
     */
    @UserName(userId = "updater")
    private String updaterTitle;

    /**
     * 商机id
     */
    private String businessId;

    /**
     * 园区id
     */
    private Long stationId;

    /**
     * 失败原因
     */
    @CodeFromTitle(code = "failureCause")
    private String failureCause;

    /**
     * 失败原因Title
     */
    @EnumItemCode(code = "failureCause")
    private String failureCauseTitle;

    /**
     * 首次来源id
     */
    private String firstSource;

    /**
     * 最近来源
     */
    private String lastSource;

    /**
     * 是否存在撞车企业
     */
    private String existCompany = MyProjectConsts.BOOLEAN.No.value();;

    /**
     * 保护期开启时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date protectDate;

    /**
     * 保护期提醒
     */
    private String protectRemind= MyProjectConsts.BOOLEAN.No.value();

    /**
     * 是否存在相同厂房
     */
    private String existOffice= MyProjectConsts.BOOLEAN.No.value();

    /**
     * 相同厂房对象集合
     */
    private List<MyProject> otherOffice;

    /**
     * 推荐厂房
     */
    private Long recommendOffice;

    /**
     * 推荐厂房名称
     */
    @OfficeName(officeId = "recommendOffice")
    private String recommendOfficeTitle;

    /**
     * 选定厂房
     */
    private Long chosenOffice;

    /**
     * 选定厂房名称
     */
    @OfficeName(officeId = "chosenOffice")
    private String chosenOfficeTitle;

    /**
     * 签约时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date signTime;

    /**
     * 签约时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String signTimeStr;
    /**
     * 到期时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date expireTime;

    /**
     * 到期时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String expireTimeStr;

    /**
     * 导入人
     */
    private Long importPerson;

    /**
     * 导入人名称
     */
    @UserName(userId = "importPerson")
    private String importPersonTitle;

    /**组织id列表*/
    private List<Long> orgIds;

    /**关键词*/
    private String keyWords;

    public String getFailedNode() {
        return failedNode;
    }

    public void setFailedNode(String failedNode) {
        this.failedNode = failedNode;
    }

    public String getCompanyStatusName() {
        return companyStatusName;
    }

    public void setCompanyStatusName(String companyStatusName) {
        this.companyStatusName = companyStatusName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    public String getCustTel() {
        return custTel;
    }

    public void setCustTel(String custTel) {
        this.custTel = custTel;
    }

    public String getIndustryType() {
        return industryType;
    }

    public void setIndustryType(String industryType) {
        this.industryType = industryType;
    }

    public String getDataSource() {
        return dataSource;
    }

    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    public String getCompanyStatus() {
        return companyStatus;
    }

    public void setCompanyStatus(String companyStatus) {
        this.companyStatus = companyStatus;
    }

    public Long getPrincipal() {
        return principal;
    }

    public void setPrincipal(Long principal) {
        this.principal = principal;
    }

    public Long getResponsibleDept() {
        return responsibleDept;
    }

    public void setResponsibleDept(Long responsibleDept) {
        this.responsibleDept = responsibleDept;
    }

    public Long getEntryPerson() {
        return entryPerson;
    }

    public void setEntryPerson(Long entryPerson) {
        this.entryPerson = entryPerson;
    }

    public Long getEntryDept() {
        return entryDept;
    }

    public void setEntryDept(Long entryDept) {
        this.entryDept = entryDept;
    }

    public String getLeavingReason() {
        return leavingReason;
    }

    public void setLeavingReason(String leavingReason) {
        this.leavingReason = leavingReason;
    }

    public String getLatestDestination() {
        return latestDestination;
    }

    public void setLatestDestination(String latestDestination) {
        this.latestDestination = latestDestination;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getUpdater() {
        return updater;
    }

    public void setUpdater(Long updater) {
        this.updater = updater;
    }

    public String getBusinessId() {
        if (!StringUtil.isEmpty(this.businessId)){
            return businessId;
        }else if (this.id != null){
            return String.valueOf(this.id);
        }else {
            return null;
        }
    }

    public void setBusinessId(String businessId) {
        this.businessId = businessId;
    }

    public Long getStationId() {
        return stationId;
    }

    public void setStationId(Long stationId) {
        this.stationId = stationId;
    }

    public String getFailureCause() {
        return failureCause;
    }

    public void setFailureCause(String failureCause) {
        this.failureCause = failureCause;
    }

    public String getFirstSource() {
        return firstSource;
    }

    public void setFirstSource(String firstSource) {
        this.firstSource = firstSource;
    }

    public String getLastSource() {
        return lastSource;
    }

    public void setLastSource(String lastSource) {
        this.lastSource = lastSource;
    }

    public String getExistCompany() {
        return existCompany;
    }

    public void setExistCompany(String existCompany) {
        this.existCompany = existCompany;
    }

    public Date getProtectDate() {
        return protectDate;
    }

    public void setProtectDate(Date protectDate) {
        this.protectDate = protectDate;
    }

    public String getProtectRemind() {
        return protectRemind;
    }

    public void setProtectRemind(String protectRemind) {
        this.protectRemind = protectRemind;
    }

    public String getExistOffice() {
        return existOffice;
    }

    public void setExistOffice(String existOffice) {
        this.existOffice = existOffice;
    }

    public Long getRecommendOffice() {
        return recommendOffice;
    }

    public void setRecommendOffice(Long recommendOffice) {
        this.recommendOffice = recommendOffice;
    }

    public Long getChosenOffice() {
        return chosenOffice;
    }

    public void setChosenOffice(Long chosenOffice) {
        this.chosenOffice = chosenOffice;
    }

    public Date getSignTime() {
        return signTime;
    }

    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }

    public Date getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }

    public String getIndustryTypeTitle() {
        return industryTypeTitle;
    }

    public void setIndustryTypeTitle(String industryTypeTitle) {
        this.industryTypeTitle = industryTypeTitle;
    }

    public String getDataSourceTitle() {
        return dataSourceTitle;
    }

    public void setDataSourceTitle(String dataSourceTitle) {
        this.dataSourceTitle = dataSourceTitle;
    }

    public String getCompanyStatusTitle() {
        return companyStatusTitle;
    }

    public void setCompanyStatusTitle(String companyStatusTitle) {
        this.companyStatusTitle = companyStatusTitle;
    }

    public String getPrincipalTitle() {
        return principalTitle;
    }

    public void setPrincipalTitle(String principalTitle) {
        this.principalTitle = principalTitle;
    }

    public String getResponsibleDeptTitle() {
        return responsibleDeptTitle;
    }

    public void setResponsibleDeptTitle(String responsibleDeptTitle) {
        this.responsibleDeptTitle = responsibleDeptTitle;
    }

    public String getEntryPersonTitle() {
        return entryPersonTitle;
    }

    public void setEntryPersonTitle(String entryPersonTitle) {
        this.entryPersonTitle = entryPersonTitle;
    }

    public String getEntryDeptTitle() {
        return entryDeptTitle;
    }

    public void setEntryDeptTitle(String entryDeptTitle) {
        this.entryDeptTitle = entryDeptTitle;
    }

    public String getLeavingReasonTitle() {
        return leavingReasonTitle;
    }

    public void setLeavingReasonTitle(String leavingReasonTitle) {
        this.leavingReasonTitle = leavingReasonTitle;
    }

    public String getUpdaterTitle() {
        return updaterTitle;
    }

    public void setUpdaterTitle(String updaterTitle) {
        this.updaterTitle = updaterTitle;
    }

    public String getFailureCauseTitle() {
        return failureCauseTitle;
    }

    public void setFailureCauseTitle(String failureCauseTitle) {
        this.failureCauseTitle = failureCauseTitle;
    }

    public List<MyProject> getOtherOffice() {
        return otherOffice;
    }

    public void setOtherOffice(List<MyProject> otherOffice) {
        this.otherOffice = otherOffice;
    }

    public String getRecommendOfficeTitle() {
        return recommendOfficeTitle;
    }

    public void setRecommendOfficeTitle(String recommendOfficeTitle) {
        this.recommendOfficeTitle = recommendOfficeTitle;
    }

    public String getChosenOfficeTitle() {
        return chosenOfficeTitle;
    }

    public void setChosenOfficeTitle(String chosenOfficeTitle) {
        this.chosenOfficeTitle = chosenOfficeTitle;
    }

    public Long getImportPerson() {
        return importPerson;
    }

    public void setImportPerson(Long importPerson) {
        this.importPerson = importPerson;
    }

    public String getImportPersonTitle() {
        return importPersonTitle;
    }

    public void setImportPersonTitle(String importPersonTitle) {
        this.importPersonTitle = importPersonTitle;
    }

    public String getSignTimeStr() {
        if (signTime != null){
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return dateformat.format(signTime);
        }
        return signTimeStr;
    }

    public void setSignTimeStr(String signTimeStr) throws ParseException {
        this.signTimeStr = signTimeStr;
        if (!StringUtil.isEmpty(signTimeStr) && signTime == null){
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            this.setSignTime(dateformat.parse(signTimeStr));
        }
    }

    public String getExpireTimeStr() {
        if (expireTime != null){
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return dateformat.format(expireTime);
        }
        return expireTimeStr;
    }

    public void setExpireTimeStr(String expireTimeStr) throws ParseException {
        this.expireTimeStr = expireTimeStr;
        if (!StringUtil.isEmpty(expireTimeStr) && expireTime ==null){
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            this.setExpireTime(dateformat.parse(expireTimeStr));
        }
    }

    public List<Long> getOrgIds() {
        return orgIds;
    }

    public void setOrgIds(List<Long> orgIds) {
        this.orgIds = orgIds;
    }

    public String getKeyWords() {
        return keyWords;
    }

    public void setKeyWords(String keyWords) {
        this.keyWords = keyWords;
    }

    public String getPrincipalPhone() {
        return principalPhone;
    }

    public void setPrincipalPhone(String principalPhone) {
        this.principalPhone = principalPhone;
    }
}
